package com.caird.pmp.iot.message.impl;

import com.caird.pmp.iot.message.MessageBase;
import io.netty.buffer.ByteBuf;
import lombok.Data;


@Data
public class ServerMessage8105 extends MessageBase {

    public ServerMessage8105() {
        id = (short)0x8105;
    }

    @Override
    public int getMaxBodyLength() {
        return 65;
    }

    @Override
    public boolean encodeBody(ByteBuf raw) {
        if (null != cmdParams && cmdParams.length() > 64)
            return false;

        //命令字
        raw.writeByte(cmd);

        //命令参数
        if (null != cmdParams)
            raw.writeBytes(cmdParams.getBytes());

        return true;
    }

    //命令字
    private byte cmd;

    //命令参数
    private String cmdParams;
}
